<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
    'id'=>'district-form',
    'enableAjaxValidation'=>false,
)); ?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <?php echo $form->textFieldRow($model,'name_en',array('class'=>'span5','maxlength'=>150)); ?>
    <?php echo $form->textFieldRow($model,'name_th',array('class'=>'span5','maxlength'=>150)); ?>
    <?php echo CHtml::label('Country', 'nationalityId');
        echo CHtml::dropDownList('nationalityId',
        $nationalityModel->id,
        CHtml::listData(Nationality::model()->getAllActive(), 'id', 'country'),
        array(
            'ajax' => array(
                'type'=>'POST',
                'url'=>CController::createUrl(Yii::app()->language . '/province/getOptionByNationalityId'),
                'update'=>'#District_province_id',
            )
        )
    ); ?>
	<?php echo $form->dropDownListRow($model, 'province_id',
	    CHtml::listData(Province::model()->getByNationalityId($nationalityModel->id), 'id', 'name')); ?>
    <?php if(!$model->isNewRecord) {
        echo $form->checkboxRow($model, 'active');
    } ?>
    <div class="form-actions">
        <?php $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType'=>'submit',
            'type'=>'primary',
            'label'=>$model->isNewRecord ? 'Create' : 'Save',
        )); ?>
    </div>

<?php $this->endWidget(); ?>
